home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_073 / lit / lit.man.pr < prev    next >
Text File  |  1992-05-06  |  10KB  |  307 lines

  1. .lm 2
  2. .rm 77
  3. .ce 1
  4. LIT TEXT UTILITY MANUAL
  5.  
  6. .ce 2
  7. Version 2.0, 11/19/86
  8. Copyright (C) 1986  Donald J. Irving
  9.  
  10. Lit is a command line invoked text utility which
  11. filters a text file to stdout printing printable characters as
  12. they are,
  13. and showing all non-printable characters in
  14. any one or more of three representation formats.
  15. The only character interpreted (acted upon) by lit is the line feed
  16. character which causes lit to issue a line feed.
  17. The inspiration for lit came from the "l" command in many of the
  18. UNIX line editors. Lit is not quite the same as any of
  19. these, however. For one thing, lit output is never ambiguous.
  20.  
  21. Here is an example of what lit does:
  22.  
  23. .nf
  24.     Say the file 'myfile' consists of the following ascii characters: 
  25.  
  26.             HT, HT, h, e, l, l, o, space, w, o, r, l, d, BEL, LF
  27.  
  28.     Saying 'lit myfile' would produce the following output:
  29.  
  30.             \t\thello world\007\n
  31.  
  32.     And saying 'lit myfile [various options]' might produce any of:
  33.  
  34.             \t\thello world^G\n
  35.             ^I^Ihello world^G^J
  36.             \011\011hello world\007\012
  37.             \09\09hello world\07\0A
  38.             \009\009hello world\007\010
  39. .fi
  40.  
  41. .ne 13
  42. You control the output with optional command line arguments which provide:
  43.  
  44. .nf
  45.     1. The name of the file to read as input.
  46.     2. What subset of the file lines to print.
  47.     3. In which format(s) to represent non-printable characters.
  48.     4. Which number base to use for numeric representations.
  49.  
  50. If you do not supply these, they default (in the original version) to:
  51.  
  52.     1. Stdin.
  53.     2. The whole file.
  54.     3. Backslash constructs if possible else  numeric representations.
  55.     4. Octal.
  56. .fi
  57.  
  58. Here is the command line template. The arguments may be specified in any
  59. order. The -bcanohd options may be stacked after one minus sign, or they
  60. may appear as separate arguments.
  61.  
  62.     lit [<filename>] [-s<linenum>] [-p<numlines>] [-[bcan][ohd]]
  63. .ne 5
  64. .ce 1
  65. THE NAME OF THE INPUT FILE
  66.  
  67. The first command line argument 
  68. encountered which does not start with a minus
  69. sign  is considered to be the input file name. Any subsequent
  70. command line argument which does not start with a minus sign is
  71. considered to be an error.
  72. If no command line argument is found which does not start with a minus
  73. sign lit uses <stdin> for input. 
  74.  
  75. .ne 10
  76. .ce 1
  77. PRINTING A SUBSET OF LINES OF THE FILE
  78.  
  79. Lit prints the whole file by default. You can tell it on which line
  80. in the file to start printing and/or how many lines to print
  81. by supplying either of both of these command line arguments:
  82.  
  83. .nf
  84.     -s<linenum>            lit will start printing at line <linenum>
  85.     -p<numlines>        lit will print <numlines> lines
  86. .fi
  87.  
  88. There is no space between the 's' or 'p' and the number. There
  89. is no validity checking on the number values.
  90.  
  91. .ne 4 
  92. .ce 1
  93. FORMATS FOR REPRESENTING NON-PRINTABLE CHARACTERS
  94.  
  95. There are three formats in which non-printable characters may be
  96. represented: C Language style backslash representations such as \n, 
  97. control character representations such as ^J, and numeric value 
  98. representations such as \012.
  99.  
  100. .ne 12
  101. C Language Backslash Representations
  102.  
  103. The form is a backslash followed by a lower case letter. Here is the list
  104. of the applicable characters:
  105.  
  106. .nf
  107.     line feed            \n
  108.     horizontal tab        \t
  109.     backspace            \b
  110.     carriage return        \r
  111.     form feed            \f
  112. .fi
  113.  
  114. The ascii NUL character representation \0 is omitted. 
  115. NUL is represented by its control
  116. character representation or as a numeric value.
  117.  
  118. .ne 4
  119. Control Character Representations
  120.  
  121. The form is a caret followed by another symbol, where the second symbol
  122. is the keyboard control character of the character to be represented.
  123. For example, the ascii line feed character is represented as ^J.
  124. The ascii character DEL has an arbitrarily assigned
  125. representation of ^?.
  126.  
  127. .ne 4
  128. ASCII Numeric Value Representations
  129.  
  130. The representation is in the form \num where num is the character's
  131. numeric value. (the unsigned integer value of its eight bits)
  132. displayed
  133. in any of the three number bases octal, decimal, or hexadecimal.
  134. For octal representations,
  135. num is exactly three octal digits; for
  136. hex representations, num is exactly two hexadecimal digits; and for 
  137. decimal representations, num is exactly three decimal digits. Num is
  138. zero-padded
  139. on the left if necessary to make up the required number of digits.
  140. For example, the ESC char is represented as \033, \027, or \1B in octal, 
  141. decimal, and hex respectively. NUL would be \000, \000, or \00.
  142. This format is not limited to ascii characters; any eight bits can be
  143. represented. Numbers of \200 (octal), \128 (decimal), \80 (hex), or
  144. greater are byte values beyond the upper end of the ascii character set.
  145. The largest byte value (all bits on) is  \377 (octal), \255 (decimal), or
  146. \FF (hex).
  147.  
  148. .ne 4
  149. .ce 1
  150. COMMAND LINE ARGUMENTS FOR SELECTING REPRESENTATION FORMATS
  151.  
  152. You tell lit which representation format or combination of formats to use
  153. for non-printable characters by supplying one of the command line
  154. arguments -b, -c, -a, or -n. If you supply none of
  155. these, then -b is selected by default.
  156. If you supply more than one, then the latter supersedes the former.
  157.  
  158. .ne 11
  159. .nf
  160.     -b        use backslash representations such as \n
  161.             if possible, else use numeric representations.
  162.  
  163.     -c        use control char representations such as ^J
  164.             if possible, else use numeric representations.
  165.  
  166.     -a        all; use backslash reps if possible, else use control
  167.             char reps if possible, else use numeric representations.
  168.  
  169.     -n        use numeric representations only.
  170. .fi
  171.  
  172.  
  173. .ne 4 
  174. You tell lit which number base to use for numeric representations by
  175. providing one of the command line
  176. arguments -o, -h, or -d. If you supply none of these, then -o is selected
  177. by default.
  178. If you supply more than one, then the latter supersedes the former.
  179.  
  180. .nf
  181. .ne 3
  182.     -o        octal
  183.     -h        hexadecimal
  184.     -d        decimal
  185. .fi
  186.  
  187.  
  188. .ne 10
  189. .ce 1
  190. EXCEPTIONAL CHARACTERS
  191.  
  192. Two characters have special meaning in lit output. The backslash
  193. character \ always has special meaning. The caret character ^ has
  194. special meaning whenever control character representations are
  195. enabled.
  196.  
  197. .ne 4
  198. The Backslash Character \
  199.  
  200. As already described, the \ character in lit output signals
  201. the beginning of either a special letter representation such as \n or a
  202. numeric representation such as \012. The \ is also used to
  203. relieve a subsequent \ or ^ of its special meaning.
  204. \\ represents the actual character \, and
  205. (when control character representations
  206. are enabled) \^ represents the actual character ^.
  207.  
  208. .ne 4
  209. The Caret Character ^
  210.  
  211. When control character
  212. representations are enabled, a ^ signals the beginning of a control
  213. character representation such as ^J. Note the implication therefore
  214. that ^^ means Control caret (ascii RS), and ^\ means Control
  215. backslash (ascii FS). In both of these cases the second character is
  216. relieved of its special meaning because it is part of the control
  217. character representation.
  218. If control character representations are not enabled, then ^ is
  219. just another printable character. 
  220.  
  221. .ne 4
  222. .ce 1
  223. CONCLUSION
  224.  
  225. Lit fills the gap between text editors which usually interpret special
  226. characters in special ways, and hex dump utilities which make terrible
  227. reading for text files.
  228. One of lit's greatest strengths is that it interprets nothing
  229. but the linefeed character; everything else is just represented to the
  230. output stream.
  231.  
  232. Although lit provides a variety of output formats, perhaps its main
  233. usefulness is in quickly locating U.F.O.s (Unidentified File Objects)
  234. that have gotten into your text files.
  235. (like that ESC char that's wierding out your printer)
  236. For this purpose, the default options are adequate, and, for C
  237. programmers at least, already familiar.
  238.  
  239.  
  240.  
  241. .ne 7
  242. .nf
  243. Donald J. Irving
  244. 9812 Gardenwood Way
  245. Sacramento, CA 95827
  246. (916) 366-3225
  247.  
  248. CIS:    73547,1335
  249. PLINK:  ops158
  250. .fi
  251.  
  252. .bp
  253. Post scripts: 
  254.  
  255. **
  256.  
  257. One convenient way of getting to know lit is to use the default
  258. input file stdin. Just say 'lit [-options]' with no file name. Now you 
  259. can type in lines one at a time and have lit filter them back to you.
  260. Try typing control characters to see how they come back.
  261. Keep in mind that in this configuration, the CLI is still trapping
  262. and interpreting (acting upon) what you type, so 
  263. screen control characters like 
  264. form feed, and tab, for example, actually cause form feeds and tabs to
  265. occur on the screen before lit has a chance to send you its output.
  266. This may make the screen look a little messy, but
  267. at least if the CLI is interpreting everything it can tell when you
  268. type Control C to break out.
  269.  
  270. **
  271.  
  272. Want to have lit give you a Usage statement? Say 'lit lskdmlsdm' where
  273. lskdmlsdm is any string of garbage which doesn't add up to the name of
  274. a real file.
  275.  
  276. **
  277.  
  278. Why not use \0 to represent NUL?
  279. Consider the following character sequence:
  280.  
  281.             BEL, space, NUL, 0, 7
  282.  
  283. Using \0 for NUL would yield the output '\007 \007'. To avoid this
  284. ambiguity,
  285. the \0 construct is not included in the backslash representations.
  286.  
  287. **
  288.  
  289. Why use ^? for DEL? Keyboard control characters are always 64 places
  290. higher in the ascii table than the non-printable characters they represent.
  291. DEL is at the high end of the ascii character set, however,
  292. so there's no keyboard character to represent it.
  293. We need to arbitrarily choose some character.
  294. The ? seems to make at least some sense as a choice; it is 64 places
  295. less than DEL, and that kind of satisfies ones desire for
  296. symmetry in the world. (Besides, some of the UNIX world tools already do
  297. it that way.)
  298.  
  299. **
  300.  
  301. If you don't like the default option settings, they are very simple to 
  302. change in the C source. If you don't have a C compiler, and can't live with
  303. the settings, I will be willing to recompile it with your desired option
  304. settings. Send me a disk in a protective mailer and include return 
  305. postage. I will return your disk in the same mailer. 
  306.  
  307.